﻿using Inovout.Gis.Element;
using Inovout.Gis.Geometry;
using Inovout.Land.Domain;
using Inovout.Service;
using System.Diagnostics;
using System.Linq;
using System.Collections.Generic;

namespace Inovout.Gis.Land
{
    public class TuBanLine : LineElement
    {
        #region Constructor

        public TuBanLine(ILineInfo lineInfo)
            : base(lineInfo)
        {
        }

        #endregion


        private List<IGeometryInfo> GetIntersectGeometriesByRepositry(params string[] layerName)
        {

            return null;
        }

        protected override IGeometryLayerElement[] GetIntersectedLayers()
        {
            if (Layer.Owner == null)
            {
                return null;
            }
            List<IGeometryInfo> intersectecdGeometriers = new List<IGeometryInfo>();
            TuBanGroupLayer tuBanGroupLayer = Layer.Owner as TuBanGroupLayer;
            if (tuBanGroupLayer == null)
            {
                tuBanGroupLayer = new TuBanGroupLayer(Layer.Owner as IGroupLayerInfo);
            }
            return new IGeometryLayerElement[]{ tuBanGroupLayer.PointLayer};
        }
        protected override string[] GetIntersectedLayerNames()
        {
            MapTopology mapTopology = MapTopology.Get();
            LayerDescriptor layerDescriptor = mapTopology.Next(Layer.Name,LayerType.Point);
            return new string[]{layerDescriptor.Name};
        }
        public string DLCode
        {
            get
            {
                return TuBan.DiLei.Code;
            }
        }
        private TuBan tuBan;

        public TuBan TuBan
        {
            get
            {
                if (tuBan == null)
                {
                    tuBan = base.Domain as TuBan;
                    if (tuBan.Area == 0)
                    {
                        tuBan.Area = NetArea;
                    }
                }
                return tuBan;
            }
        }
    }
}
